<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>Example Client : OAuth CrossDomain JavaScript Proxy</title>
		<script type="text/javascript" src="http://xdoauthproxy.appspot.com/js/json2.js"></script>
		<script type="text/javascript" src="http://xdoauthproxy.appspot.com/js/xd-oauth-client.js"></script>
    <script type="text/javascript">
function startXdRequest() {
  XdOAuth.init('http://xdoauthproxy.appspot.com/xd-server.html');
  XdOAuth.request({
    url : 'http://www.google.com/calendar/feeds/default/private/full?alt=json',
    success : function(data) {
      var result = eval('(' + data + ')');
      var html = [];
      for (var i=0; i<result.feed.entry.length; i++) {
        var entry = result.feed.entry[i];
        html.push('<li>'+entry.title.$t+'</li>');
      }
      document.getElementById('result').innerHTML = html.join('');
    },
    error : function(res) {
      alert(res.status + ':' + res.body);
    }
  });
}
    </script>
	</head>
	<body>
    <!-- place dummy image file on the same domain where client html file is located. -->
    <img src="./img/s.gif" />
    <input type="button" onclick="startXdRequest()" value="Start OAuth Request to get private Google Calendar">
    <ul id="result"></ul>
	</body>
</html>

